<!DOCTYPE html>
<html>
<head>
	<% include link %>
	<link rel="stylesheet" type="text/css" href="/css/user.css">
</head>
<body>
	<% include head %>
	<div class="myself-top-head">
		<img src="/images/myselfTitle.png" class="myself-top-img">
	</div>
	<div class="container">
		<div class="row ">
			<% include usermodle %>
	  		<div class="col-md-8  body-right">
	  			<a href="javascript:void(0)" id="sign" class="btn btn-info active" style="float:right" role="button">签&nbsp;&nbsp;&nbsp;到</a>
				<div class="col-md-2 user-index-headlog">
					<img src="<%-user.headImgUrl%>" class="img-circle user-index-headimg">
					<a href="/userhome/<%-user._id%>" class="user-index-amyself">个人空间</a>
				</div>
				<div class="col-md-10 user-index-namediv">
					<p class="user-index-namefont">
						<%-user.name%>
						<span class="user-index-hyfont">正式会员</span>
					</p>
					<label class="user-index-lv" id="user-index-lv">LV:1</label>
					<div class="progress">
						<div class="progress-bar progress-bar-info progress-bar-striped" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 0%" id="user-index-lvpoint">
						</div>
					</div>
				</div>
				<div class="col-md-12" style="border-top:1px dashed #DCDBDD;padding-bottom: 35px;">			
				</div>
				<div class="col-md-12">
					<div class="col-md-6 user-fku">
						<% if (user.Fans) {%>
						<p><span class="glyphicon glyphicon-heart"></span>我的粉丝<span><%- user.Fans.length %></span>Fans</p>
						<%} else{%>
						<p><span class="glyphicon glyphicon-heart"></span>我的粉丝:<span>0</span>Fans</p>
						<%}%>
					</div>
					<div class="col-md-6 user-fku">
						<% if (user.keepAT ) {%>
						<p><span class="glyphicon glyphicon-star"></span>收藏博客<span><%- user.keepAT.length %></span>Favors</p>
						<%} else{%>
						<p><span class="glyphicon glyphicon-star"></span>收藏博客<span>0</span>Favors</p>
						<%}%>
					</div>
					<div class="col-md-6 user-fku">
					<% if (user.keepAV ) {%>
						<p><span class="glyphicon glyphicon-star-empty"></span>收藏视频<span><%- user.keepAV.length %></span>Favors</p>
						<%} else{%>
						<p><span class="glyphicon glyphicon-star-empty"></span>收藏视频<span>0</span>Favors</p>
						<%}%>
					</div>
					<div class="col-md-6 user-fku">
						<p><span class="glyphicon glyphicon-upload"></span>投稿总数<span><%- count%></span>Posts</p>
					</div>
				</div>
	  		</div>
		</div>
	</div>

	<% include foot %>
<script type="text/javascript">
	$('#user-index').addClass("active");
	$('#user-index-lv').html("LV:"+user_ex);
	$('#user-index-lvpoint').css('width',user_percent);


	init();

	function init(){
		if ("<%- user.sign%>") {
			var oldSign = parseInt("<%- user.sign%>");
			oldSign = new Date(oldSign);
			var sign = new Date();
			if (oldSign.getFullYear() == sign.getFullYear() && oldSign.getMonth() == sign.getMonth() && oldSign.getDate() == sign.getDate()) {
				$('#sign').html('已签到');
			} else {
				$('#sign').click(function() {
				$.ajax({
					url:'/user/sign',
					type:'get',
					success: function(date){
						if(date == "ok"){
							Messenger().post({
								  message:"签到成功　EXP +10",
								  hideAfter: 1,
							});
							$('#sign').html('已签到');
							$('#user-index-lvpoint').css('width',user_percent+10);
						} 
					}
				});
				});
			}
		} else{
			$('#sign').click(function() {
				$.ajax({
					url:'/user/sign',
					type:'get',
					success: function(date){
						if(date == "ok"){
							Messenger().post({
								  message:"签到成功　EXP +10",
								  hideAfter: 1,
							});
							$('#sign').html('已签到');
							$('#user-index-lvpoint').css('width',user_percent+10);
						} 
					}
				});
			});
		}
	}

</script>
</body>
</html>